#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std; 

int main()
{
	vector<int> a; 
	unsigned w, n, i, j, sum, r=0; 
	
	//freopen("p1094.in", "r", stdin); 
	cin>>w; 
	cin>>n; 
	a.resize(n); 
	for (i=0; i<n; i++) {
		cin>>a[i]; 
	}
	sort(a.begin(), a.end()); 
	i=0; 
	j=n-1; 
	while(i<=j) {
		if (i!=j) {
			if (a[i]+a[j]<=w) {
				i++;
				j--; 
			} else {
				j--; 
			}
			r++; 
		} else{
			r++; 
			break; 
		}
	}
	cout<<r<<endl; 
	return 0; 
}

